package com.lz.football.module.wineBar.item
{
	import com.lz.football.module.base.IComponent;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import lz.controls.LButton;
	import lz.controls.LItem;

	/**
	 * 酒条目 
	 * @author lake
	 * 
	 */	
	public class WineItem extends LItem implements IComponent
	{
		/**
		 *选择按钮 
		 */		
		public var selectBtn 		:MovieClip;
		/**
		 *选中效果 
		 */		
		public var selectStatusMc :MovieClip;
		/**
		 *价格 
		 */		
		public var txtValue		   :TextField;
		/**
		 *是否选择 
		 */		
		private var _isSelect     :Boolean = false;
		/**
		 *价格 
		 */		
		public var price			:int;
		/**
		 *类型 
		 */		
		public var type				:int;
		
		public function WineItem()
		{
			super();
		}
		/**
		 *获取设置是否选择 
		 * @param value
		 * 
		 */		
		public function set isSelect(value :Boolean):void
		{
			_isSelect = value;
			if(_isSelect)
			{
				//selectBtn.gotoAndStop(3);
				selectStatusMc.visible = true;
			}
			else
			{
				//selectBtn.gotoAndStop(1);
				selectStatusMc.visible = false;
			}
		}
		public function get isSelect():Boolean
		{
			return _isSelect;
		}
		/**
		 *获取皮肤 
		 * @return 
		 * 
		 */		
		public function get symbolSkin():MovieClip
		{
			return _symbolSkin;
		}
		/**
		 *初始化 
		 * 
		 */	
		public function initUI(view:Object=null):void
		{
			_symbolSkin = view as MovieClip;
			selectBtn = _symbolSkin.selectBtn;
			txtValue = _symbolSkin.txtValue;
			selectStatusMc = _symbolSkin.selectStatusMc;
			selectStatusMc.visible = false;
			selectBtn.visible = false;
			selectBtn.buttonMode = true;
			addEvtListener();
		}
		/**
		 *注册事件 
		 * 
		 */	
		public function addEvtListener():void
		{
			_symbolSkin.addEventListener(MouseEvent.CLICK,clickSelectHandler);
		}
		/**
		 *点击选择 
		 * @param e
		 * 
		 */		
		private function clickSelectHandler(e :MouseEvent):void
		{
			this.dispatchEvent(new Event("selectWine",true));
		}
		/**
		 *删除事件 
		 * 
		 */
		public function removeEvtListener():void
		{
			_symbolSkin.removeEventListener(MouseEvent.CLICK,clickSelectHandler);
		}
		/**
		 *销毁 
		 * 
		 */	
		public function destroyView():void
		{
			removeEvtListener();
			_symbolSkin = null;
		}
	}
}